import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { IPage, ICheckProject } from "./types";

/* 查询公告列表 */
export function getPageCheckProjectAPI(
  queryParams?: IPage
): AxiosPromise<PageResult<ICheckProject[]>> {
  return request({
    url: "/checkProject/page",
    method: "get",
    params: queryParams,
  });
}
/* 根据id查询公告对象 */
export function getFormCheckProjectAPI(id: number): AxiosPromise<ICheckProject> {
  return request({
    url: `/checkProject/${id}/form`,
    method: "get",
  });
}

/**
 * 添加公告
 *
 * @param data
 */
export function addCheckProjectAPI(data: any) {
  return request({
    url: "/checkProject",
    method: "post",
    data: data,
  });
}

/**
 * 修改公告
 *
 * @param id
 * @param data
 */
export function updateCheckProjectAPI(id: number, data: ICheckProject) {
  return request({
    url: "/checkProject/" + id,
    method: "put",
    data: data,
  });
}

/**
 * 删除公告
 *
 * @param ids
 */
export function deleteCheckProjectAPI(ids: number) {
  return request({
    url: "/checkProject/" + ids,
    method: "delete",
  });
}
